package vip.zhenzicheng.algorithm.huawei_od;

import java.util.Scanner;

/**
 * 输入一串字符串，输出每8个字符为一行的字符串，如果不够则补全"0"到8个长度
 * 例如：abc -> abc0000077
 *
 * @author zhenzicheng
 * @date 2023-02-24 17:19
 */
public class Hj4 {
  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    // 注意 hasNext 和 hasNextLine 的区别
    if (in.hasNextLine()) { // 注意 while 处理多个 case
      String str = in.nextLine();
      int len = str.length();
      int numOf8 = len / 8;
      int extraNum = (len % 8);
      printOf8(str, numOf8, extraNum == 0 ? 0 : 8 - extraNum);
    }
  }

  private static void printOf8(String str, int loop, int extraNum) {
    int index = 0;
    while (--loop >= 0) {
      String res = str.substring(index, index + 8);
      System.out.println(res);
      index += 8;
    }
    if (extraNum != 0) {
      StringBuilder sb = new StringBuilder();
      String lastStr = str.substring(index);
      sb.append(lastStr);
      while (--extraNum >= 0) {
        sb.append("0");
      }
      System.out.println(sb);
    }
  }
}
